
package com.y.fund.utils;

import java.util.LinkedHashMap;

public class SQLUtil {

	/** 数据中排序字段的默认值 */
	public static final int SORT_DEF_VAL = 90;
	
	/** 一次查询中允许查询的最大记录条数 */
	public static final int MAX_QUERY_SIZE = 10000;

	/** Unlimited number of records  */
	@Deprecated
	public static final int UN_LIMIT_SIZE = -99;

	/** Filter special characters in SQL parameters  */
	public static String FilterParam(String p){
		if(null==p){
			return p;
		}
		return p.replaceAll(" or ", "").replaceAll("'", "''").replaceAll(";drop ", "").replaceAll(" drop ", "").replaceAll(";insert ", "").replaceAll(" insert ", "")
				.replaceAll(";delete ", "").replaceAll(" delete ", "").replaceAll(";create ", "").replaceAll(" create ", "").replaceAll(";update ", "").replaceAll(" update ", "");
	}
	
	/** 按 procedureName 字段升序排序 */
	public static final LinkedHashMap<String, String> ProcedureNameOrderMap = new LinkedHashMap<String, String>();
	static {
		ProcedureNameOrderMap.put("procedureName", "asc");
	}
	
	/**  按上传时间降序排序 */
	public static final LinkedHashMap<String, String> UploadTimeDescOrder = new LinkedHashMap<String, String>();
	static {
		UploadTimeDescOrder.put("uploadTime", "desc");
	}
	
	/**  Sort in descending order by the creation time field createtime  */
	public static final LinkedHashMap<String, String> EditTimeDescOrder = new LinkedHashMap<String, String>();
	static {
		EditTimeDescOrder.put("editTime", "desc");
	}

	/** 按 createtime 字段升序排序 */
	public static final LinkedHashMap<String, String> CreateTimeAscOrder = new LinkedHashMap<String, String>();
	static {
		CreateTimeAscOrder.put("createTime", "asc");
	}

	/** 按 time 字段升序排序 */
	public static final LinkedHashMap<String, String> TimeASCOrder = new LinkedHashMap<String, String>();
	static {
		TimeASCOrder.put("time", "asc");
	}

	/** 按 createtime 字段降序排序 */
	public static final LinkedHashMap<String, String> CreateTimeDescOrder = new LinkedHashMap<String, String>();
	static {
		CreateTimeDescOrder.put("createTime", "desc");
	}

	/** Sort ascending by name field name */
	public static final LinkedHashMap<String, String> NameAscOrder = new LinkedHashMap<String, String>();
	static {
		NameAscOrder.put("name", "asc");
	}

	/** Sort ascending by name field name */
	public static final LinkedHashMap<String, String> IdAscOrder = new LinkedHashMap<String, String>();
	static {
		IdAscOrder.put("id", "asc");
	}
	/** 按 sort 字段升序排列  */
	public static final LinkedHashMap<String, String> SortAscCreateTimeAscOrder = new LinkedHashMap<String, String>();
	static {
		SortAscCreateTimeAscOrder.put("sort", "asc");
		SortAscCreateTimeAscOrder.put("id", "asc");
	}


	/**  Sort in ascending order by the sorting field ordernum and the name field name */
	public static final LinkedHashMap<String, String> OrderNumAscOrder = new LinkedHashMap<String, String>();
	static {
		OrderNumAscOrder.put("orderNum", "asc");
	}
	
	/** Sort in ascending order by the sorting field ordernum and the name field name */
	public static final LinkedHashMap<String, String> OrderNumNameAscOrder = new LinkedHashMap<String, String>();
	static {
		OrderNumNameAscOrder.put("orderNum", "asc");
		OrderNumNameAscOrder.put("name", "asc");
	}

	
	
}
